package test.test6_24;
/*
定义一个Teacher类：
包含4个成员变量 String name, int age, String gender, int teacherId
然后定义5个构造方法：
无参构造
name单参构造方法
name和teacherId双参构造方法
name，age和gender的三参构造器
name，age，gender和teacherId的四参构造器（要求用this调用已存在的三参构造器）
 */
class Teacher {
    String name;
    int age;
    String gender;
    int teacherId;

    public Teacher() {

    }
    public Teacher(String name , int teacherId) {
        this.name = name;
        this.teacherId = teacherId;
    }
    public Teacher(String name,int age,String gender) {
        this.name = name;
        this.age = age;
        this.gender = gender;
    }
    public Teacher(String name, int age, String gender, int teacherId) {
        this(name,age,gender);
        this.teacherId = teacherId;
    }
    public void print() {
        System.out.println(name+age+gender+teacherId);
    }
}
class Demo03 {
    /*
    要求t1对象的四个成员变量name, age, gender, teacherId的值分别为"张三"、18、"男"、 1
    要求t2对象的四个成员变量name, age, gender, teacherId的值分别为"李四"、25、"女"、 2
     */
    public static void main(String[] args) {
        Teacher t1 = new Teacher("张三,",18,",男,",1);
        t1.print();

        Teacher t2 = new Teacher("李四,",25,",女,",2);
        t2.print();


    }
}

